<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("input[type='button']").click(function () {
                //获取表单数据
                var data = $("form").serialize();
                $.post("/person/save",data,function (result) {
                    if (result == 'success'){
                        alert("添加员工成功！");
                        location.href = "/person/toList";
                    }else{
                        alert("添加员工失败，请稍后再试！")
                    }
                })
            })
            $("#back").click(function () {
                history.back();
            })
        })
    </script>
</head>
<body>
<div align="center">
    <h3>添加用户信息</h3>
    <form >
        <table border="1" cellspacing="0" align="center">
            <tr>
                <td>姓名：</td>
                <td>
                    <input type="text" name="name">
                </td>
            </tr>
            <tr>
                <td>性别：</td>
                <td>
                    <select name="gender" >
                        <option value="-1">--请选择--</option>
                        <option value="1">男</option>
                        <option value="0">女</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>年龄：</td>
                <td>
                    <input type="text" name="age">
                </td>
            </tr>
            <tr>
                <td>等级：</td>
                <td>
                    <select name="rank">
                        <option value="-1">--请选择--</option>
                        <option value="1">1级</option>
                        <option value="2">2级</option>
                        <option value="3">3级</option>
                        <option value="4">4级</option>
                        <option value="5">5级</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>部门：</td>
                <td>
                    <select name="department">
                        <option value="">--请选择--</option>
                        <option value="开发部">开发部</option>
                        <option value="支持部">支持部</option>
                        <option value="测试部">测试部</option>
                    </select>
                </td>
            </tr>
            <tr align="center">
                <td colspan="2">
                    <input type="button" value="保存">
                    <input type="reset" value="重置">
                </td>
            </tr>
        </table>
        <div align="center">
            <button type="button" id="back">返回</button>
        </div>
    </form>
</div>
</body>
</html>